package main

import (
	"flag"
	"fmt"
	"go_auth/ext/settings"
	"go_auth/ext/setup"
	"go_auth/models/admin"
	"go_auth/models/users"
	"strings"
)

func SyToTable() {

	cfg := flag.String("c", "conf/config.json", "configuration file")
	flag.Parse()
	setup.SetUp(*cfg)
	sync2 := settings.MasterDB.Sync2(new(users.User))
	settings.MasterDB.Sync2(new(users.Per))
	settings.MasterDB.Sync2(new(users.Role))
	settings.MasterDB.Sync2(new(users.RolePer))
	settings.MasterDB.Sync2(new(users.Source))
	settings.MasterDB.Sync2(new(users.UserRole))
	settings.MasterDB.Sync2(new(users.UserSource))
	settings.MasterDB.Sync2(new(users.UserPer))
	settings.MasterDB.Sync2(new(users.CertKey))

	//AdInfo  CertKey
	settings.MasterDB.Sync2(new(admin.AdInfo))
	fmt.Println(sync2)
}

//func MgoConn() {
//	newClient, err := mongo.NewClient("mongodb://qdata:%40hk%40%24!%25%26*987%40!@47.254.35.249:27017")
//
//	if err != nil {
//		fmt.Println(err)
//	}
//	collection := newClient.Database("qdata").Collection("news")
//	cur, err := collection.Find(context.Background(), nil)
//	fmt.Println(cur,err)
//}

func main() {
	//SyToTable()
	//MgoConn()
	s := []string{"1_post", "2_get"}
	m := "1_POst"

	for _, v := range s {
		if strings.EqualFold(v, m) {
			fmt.Println(v, m)
		}
	}
	//ints := sort.SearchStrings(s, m)
	//print(ints)
}
